{-----------------------------------------------------------------------------
 m_historypp (historypp project)

 Version:   1.5
 Created:   06.08.2004
 Author:    Oxygen

 [ Description ]

 Header with History++ services declaration

 [ History ]

 1.5 (05.08.2004)
   First version

 [ Modifications ]
 none

 [ Known Issues ]
 none

 Copyright (c) Art Fedorov, 2004
-----------------------------------------------------------------------------}

{$IFNDEF M_HISTORYPP}
{$DEFINE M_HISTORYPP}

const

    //** VALUES FOR TItemRenderDetails.dwHistoryWindow
    //** Used in ME_HPP_RICHEDIT_ITEMPROCESS event
    //** This is one of the following params,
    //** saying what kind of history window displays
    //** processed item.

    // IRDHW_CONTACTHISTORY. The window is ordinary
    // contact history.
    IRDHW_CONTACTHISTORY = $0001;
    // IRDHW_GLOBALHISTORY. The window is global
    // history (system history). Invokes by
    // Menu -> System History
    IRDHW_GLOBALHISTORY  = $0002;
    // IRDHW_GLOBALSEARCH. The window is search
    // window and the processed item is the
    // result of the global search.
    IRDHW_GLOBALSEARCH   = $0003;
    // IRDHW_EXTERNAL. The window is external window
    IRDHW_EXTERNALGRID   = $0004;

    //** VALUES FOR TItemRenderDetails.dwFlags
    //** Used in ME_HPP_RICHEDIT_ITEMPROCESS event
    //** These flags inform you about what you are
    //** processing. Like saying that the item is
    //** selected or it's inline or such stuff

    // IRDF_SELECTED. The processed item is selected.
    // The background color will always be clHighlight
    // even if you change it (i will change it back).
    // Though, I will not touch font or font color.
    IRDF_SELECTED = $0001;
    // IRDF_INLINE. The RichEdit provided is not one
    // that is used for drawing a cell, but the one
    // used for "inline editing".
    IRDF_INLINE   = $0002;
    // IRDF_EVENT. The RichEdit provided is from "Open Event"
    // window. It's the window which opens when you right-click
    // item in contact's history and select "Open"
    IRDF_EVENT    = $0004;

type
  TItemRenderDetails = packed record
    cbSize: DWord;          // size of the structure in bytes
    hContact: THandle;      // handle to the contact for which the event is processed
    hDBEvent: THandle;      // handle to the event which is processed
    dwEventTime: DWord;     // timestamp of the event
    wEventType: Word;       // Event's flags (see m_database, EVENTTYPE_*; m_icq, ICQEVENTTYPE_*)
    IsEventSent: ByteBool;  // Outgoing event. True if DBEF_SENT event flag is present (see m_database)
    dwFlags: DWord;         // Any reasonable combination of IRDF_* flags.
    bHistoryWindow: Byte;   // What kind of window history. See IRDHW_* values
    pProto: PChar;          // Proto of the event, if available
    pModule: PChar;         // Module of the event, if available
    pText: PWideChar;       // Text of the event, not used now
    pExtended: PChar;       // Extended text, used for storing urls, paths and so on
  end;

  PItemRenderDetails = ^TItemRenderDetails;

const
  // ME_HPP_RICHEDIT_ITEMPROCESS
  // (supported from 1.5.0)
  // Called when next RichEdit history item
  // is rendered. Third-party plugins can alter it
  // like adding smileys, changing color and so on.
  // wParam - RichEdit control handle
  // lParam - pointer to TItemRenderDetails structure, information
  //          about processed item, see TItemRenderDetails for details
  //
  // Note: Changing richedit background color will change the background
  //       color of the whole cell! Additionally, the background color
  //       of the *selected* cell and richedit is ALWAYS clHighlight,
  //       no matter what you do. But font is untouched, so if your
  //       plugin changes font color, you may need to handle selected
  //       cells differently (use IF_SELECTED flag).
  //
  // Warn: Remeber about changing fonts. You CAN NOT have *different* fonts
  //       for the *same* item, depening on your wish. For example, the
  //       first time event is fired you set font for Item1 'Arial 10',
  //       and the next time you set font for the same Item1 'Arial 12'.
  //       Because height is calculated only once, and you may have
  //       problems with text painting (when you change font text can
  //       become too large and be cut or override another cell)
  //
  // See:  hpp_itemprocess_samples.pas for some sample event handlers
  //       like SmileyAdd and TextFormat support and special handler
  //       kinda of conversation separation
  ME_HPP_RICHEDIT_ITEMPROCESS = 'History++/RichEdit/ItemProcessEvent';

  // MS_HPP_SHOWGLOBALSEARCH
  // (supported from 1.5.0)
  // Show Global history search window
  // If already opened, bring it to front
  // wParam - zero
  // lParam - zero
  MS_HPP_SHOWGLOBALSEARCH = 'History++/ShowGlobalSearch';

  type
    TOpenEventParams = packed record
      cbSize: DWord;
      hContact: DWord;
      hDBEvent: DWord;
      pPassword: PChar;
    end;

  POpenEventParams = ^TOpenEventParams;

const

  // MS_HPP_OPENHISTORYEVENT
  // (supported from 1.5.0)
  // (changed in 1.5.110)
  //
  // Opens contact's history and selects
  // provided event
  // wParam - pointer to TOpenEventParams structure
  // lParam - zero
  // Return - BOOL, True if contact opened, False if password
  //          field opened
  // Note: if you just want to show contact's history,
  //       use system service MS_HISTORY_SHOWCONTACTHISTORY
  MS_HPP_OPENHISTORYEVENT = 'History++/OpenHistoryEvent2';

  // MS_HPP_GETVERSION
  // (supported from 1.5.0)
  // Get current History++ version
  // Third-party plugins can use it to know if installed
  // version of History++ supports particular feature
  // wParam - zero
  // lParam - zero
  // Return - current version, via PLUGIN_MAKE_VERSION macro
  MS_HPP_GETVERSION = 'History++/GetVersion';

{$ENDIF}
